import {actionTypes} from './index'
import {formatLocation} from '@/util'

const changeLocation = (value) => ({
    type: actionTypes.CHANGE_LOCATION,
    value
})

export const getLocation = (pathname) => {
    return (dispatch) => {
        const location = formatLocation(pathname)
        dispatch(changeLocation(location))
    }
}
